package zzf.controller;

/*
*
* */

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class BookController {

    /*
    * 处理查询图书请求
    * */
    @RequestMapping(value = "book/{bid}",method = RequestMethod.GET)
    public String getBook(@PathVariable("bid")Integer bid){
        System.out.println("查询到了"+bid+"图书");
        return "success";
    }

    /*
    * 删除图书
    * */
    @RequestMapping(value = "book/{bid}",method = RequestMethod.DELETE)
    public String deleteBook(@PathVariable("bid")Integer bid){
        System.out.println("删除了"+bid+"图书");
        return "success";
    }



    @RequestMapping(value = "book",method = RequestMethod.POST)
    public String addBook(){
        System.out.println("添加了一本图书");
        return "success";
    }

    /*
    * 更新图书
    * */
    @RequestMapping(value = "book/{bid}",method = RequestMethod.PUT)
    public String updateBook(@PathVariable("bid")Integer bid){
        System.out.println("更新了"+bid+"图书");
        return "success";
    }


    @RequestMapping("/test")
    public String test(){
        System.out.println("测试图书控制器");
        return "success";
    }
}
